-
Notifications
You must be signed in to change notification settings - Fork 37
fix: Fix the issue where the input box cannot lose focus #356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's GuideAdds a mouse press handler on CompressSettingPage to clear focus from various input fields when the user clicks on the blank area, and updates the class interface to declare this new event handler as a protected override while moving isOrderMode() to the public section. Sequence diagram for clearing input focus on blank area clicksequenceDiagram
actor User
participant CompressSettingPage
participant FileNameEdt
participant SavePathEdt
participant PasswordEdt
participant SplitValueEdt
participant CommentEdt
participant DWidget
User->>CompressSettingPage: mousePressEvent(event)
activate CompressSettingPage
CompressSettingPage->>FileNameEdt: lineEdit().hasFocus()
alt FileNameEdt has focus
CompressSettingPage->>FileNameEdt: lineEdit().clearFocus()
end
CompressSettingPage->>SavePathEdt: lineEdit().hasFocus()
alt SavePathEdt has focus
CompressSettingPage->>SavePathEdt: lineEdit().clearFocus()
end
CompressSettingPage->>PasswordEdt: lineEdit().hasFocus()
alt PasswordEdt has focus
CompressSettingPage->>PasswordEdt: lineEdit().clearFocus()
end
CompressSettingPage->>SplitValueEdt: hasFocus()
alt SplitValueEdt has focus
CompressSettingPage->>SplitValueEdt: clearFocus()
end
CompressSettingPage->>CommentEdt: hasFocus()
alt CommentEdt has focus
CompressSettingPage->>CommentEdt: clearFocus()
end
CompressSettingPage->>DWidget: mousePressEvent(event)
deactivate CompressSettingPage
Updated class diagram for CompressSettingPageclassDiagram
class DWidget
class CompressSettingPage {
+QString getComment()
+bool isOrderMode()
+bool eventFilter(QObject watched, QEvent event)
#void mousePressEvent(QMouseEvent event)
-DLineEdit m_pFileNameEdt
-DLineEdit m_pSavePathEdt
-DLineEdit m_pPasswordEdt
-QLineEdit m_pSplitValueEdt
-QTextEdit m_pCommentEdt
}
CompressSettingPage --|> DWidget
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey - I've left some high level feedback:
- Clearing focus on every mouse press may interfere with expected behavior when clicking inside other interactive child widgets; consider checking whether the click occurred on a genuinely empty/outer area (e.g., via
childAtor checking the event target) before clearing focus. - The
mousePressEventcurrently logs withqDebug()on every click when a field has focus; if this is only for debugging the original issue, consider removing or guarding these logs to avoid noisy output in normal use.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Clearing focus on every mouse press may interfere with expected behavior when clicking inside other interactive child widgets; consider checking whether the click occurred on a genuinely empty/outer area (e.g., via `childAt` or checking the event target) before clearing focus.
- The `mousePressEvent` currently logs with `qDebug()` on every click when a field has focus; if this is only for debugging the original issue, consider removing or guarding these logs to avoid noisy output in normal use.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lzwind, pengfeixx The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Fix the issue where the input box cannot lose focus Log: Fix the issue where the input box cannot lose focus
deepin pr auto review这段代码主要实现了在 1. 语法逻辑
2. 代码质量
3. 代码性能
4. 代码安全
改进后的代码示例
|
Fix the issue where the input box cannot lose focus
Log: Fix the issue where the input box cannot lose focus
Summary by Sourcery
Bug Fixes: